<?php echo $header; ?>
<div id="content">
	<div class="breadcrumb">
		<?php echo $this->breadCrumbs(); ?>
		<?php foreach ($breadcrumbs as $breadcrumb) { ?>
			<?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
		<?php } ?>
	</div>
  <?php if (isset($error_warning)) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/category.png" alt="" /> <?php echo $_['heading_title']; ?></h1>
      <div class="buttons"><a onclick="location = '<?php echo UA('catalog/category/insert'); ?>'" class="button"><?php echo $_['button_insert']; ?></a><a onclick="$('#form').submit();" class="button"><?php echo $_['button_delete']; ?></a> | <a onclick="location = '<?php echo UA('catalog/category/update_cache'); ?>'" class="button"><?php echo $_['button_update_cache']; ?></a></div>
    </div>
    <div class="content">
      <form action="<?php echo UA('catalog/category/delete'); ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="J_tablelist list" data-acturi="<?php echo UA('catalog/category/smartedit');?>">
          <thead>
            <tr>
              <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
              <td class="left"><?php echo $_['column_name']; ?></td>
			  <td class="left"><?php echo $_['column_sub_category']; ?></td>
			  <td class="left"><?php echo $_['text_product']; ?></td>
			  <td class="right"><?php echo $_['column_top']; ?></td>			  
              <td class="right"><?php echo $_['column_columns']; ?></td>
              <td class="right"><?php echo $_['column_column_width']; ?></td>
              <td class="right"><?php echo $_['column_group']; ?></td>
              <td class="right"><?php echo $_['column_sort_order']; ?></td>
              <td class="right"><?php echo $_['column_status']; ?></td>
              <td class="right"><?php echo $_['column_action']; ?></td>
            </tr>
          </thead>
          <tbody>
            <?php if ($categories) { ?>
            <?php foreach ($categories as $category) { ?>
            <tr onmouseover="this.className='on';" onmouseout="this.className='';">
            <td>
                <input type="checkbox" name="selected[]" value="<?php echo $category['category_id']; ?>" />
            </td>
              <td class="left">
              <?php if ($category['type'] == 0) { ?>
	              <a href="<?php echo U('product/category', 'category_id=' . $category['category_id']);?>" target="_blank">
	              <?php echo $category['name']; ?>
	              </a> (<?php echo $category['total']; ?>)
              <?php } elseif ($category['type'] == 1) { ?>
              	<a href="<?php echo $category['external_link'];?>" title="<?php echo $_['option_category_types'][1];?>" target="_blank"><span class="blue"><?php echo $category['name']; ?></span></a>
              <?php } else {?>
              	<?php echo $category['name']; ?>
              <?php }?>
              </td>
			  <td>[ <a href="<?php echo UA('catalog/category', 'category_id=' . $category['category_id']);?>"><?php echo $_['text_sub_category']; ?> ]</a></td>
			  <td>
				[ <a href="<?php echo UA('catalog/product', 'filter_category_id=' . $category['category_id']); ?>"><?php echo $_['text_product']; ?></a> ]
              </td>
              <td class="right"><img class="cur" src="view/image/<?php echo $category['top'] ? 'enabled' : 'disabled'; ?>.png" data-tdtype="toggle" data-field="top" data-id="<?php echo $category['category_id'];?>" data-value="<?php echo $category['top']; ?>"></td>
              <td class="right">
              	<span data-tdtype="edit" data-field="column" data-id="<?php echo $category['category_id'];?>"><?php echo $category['column']; ?></span>
              </td>
              <td class="right">
              	<span data-tdtype="edit" data-field="columns" data-id="<?php echo $category['category_id'];?>"><?php echo $category['columns']; ?></span>
              </td>
              <td class="right">
              	<span data-tdtype="edit" data-field="group" data-id="<?php echo $category['category_id'];?>"><?php echo $category['group']; ?></span>
              </td>
              <td class="right">
              <span data-tdtype="edit" data-field="sort_order" data-id="<?php echo $category['category_id'];?>"><?php echo $category['sort_order']; ?></span>
                </td>
              <td class="right"><img class="cur" src="view/image/<?php echo $category['status'] ? 'enabled' : 'disabled'; ?>.png" data-tdtype="toggle" data-field="status" data-id="<?php echo $category['category_id'];?>" data-value="<?php echo $category['status']; ?>"></td>
              <td class="right">
                [ <a href="<?php echo UA('catalog/category/update', 'category_id=' . $category['category_id']); ?>"><?php echo $_['text_edit']; ?></a> ]
              </td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="7"><?php echo $_['text_no_results']; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
    </div>
  </div>
</div>
<script>
$('.J_tablelist').listTable();
</script>
<?php echo $footer; ?>